public class CountSub {
    public static String s = "hello world, hello eclipse, hello idea, hello springhellohello";
    public static String target = "hello";

    public static void main(String[] args) throws Exception {
        int cnt = 0;
        for (int i = 0; i < s.length(); i++) {
            boolean res = s.startsWith(target, i);
            if (res) {
                ++cnt;
                i += target.length() - 1;
            }
        }
        System.out.println(cnt);
    }
}
